﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="add_role.aspx.cs" Inherits="Setting_add_role" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>添加角色</title>
    <link href="../Styles/Site.css" rel="stylesheet" type="text/css" />
    <script src="../Scripts/jquery-1.5.1.min.js" type="text/javascript"></script>
	<script src="../Scripts/jquery-ui-1.8.14/jquery-ui-1.8.14.custom.min.js" type="text/javascript"></script>
    <link href="../Scripts/dynatree-1.1.1/skin-vista/ui.dynatree.css" rel="stylesheet" type="text/css" />
    <script src="../Scripts/dynatree-1.1.1/jquery.dynatree.js" type="text/javascript"></script>
    <style type="text/css">
		#treeContainer{ width:400px; height:300px; overflow:auto; border:solid 1px #dddddd;}
    </style>
    <script type="text/javascript">
    	$(function () {
    		 $("#tree").dynatree({
                checkbox: true,
                selectMode: 2,
                children: [
					<%=nodeArrayString %>
				]
            });
    	});

    	function VerifyForm() {
    		if ($("#roleName").val() == "") {
    			alert('角色名称不能为空!');
    			return false;
    		}
    		return true;
    	}
    	function doSave() {
    		if (VerifyForm()) {
				var selNodes = $("#tree").dynatree("getSelectedNodes");
				if (selNodes != null && typeof (selNodes) != 'undefined') {
					var funcid = "";
    				$.map(selNodes, function (node) {
						funcid += "," + node.data.key ;
    				});
					$("#hidSelFuncId").val(funcid);
    			}
    			form1.submit();
    		}
    	}
    </script>
</head>
<body >
    <form id="form1" runat="server">
    <div class="editFormTitle">添加角色</div>
	<div >
	 <table id="EmplInfo" border="0" cellpadding="3">
		<tr><td nowrap width="40">名称</td><td><input type="text" id="roleName" name="roleName" style="width:200px;" value="<%=curRole.Name %>" /></td></tr>
		<tr><td>描述</td><td><textarea id="descr" name="descr" rows="2" cols="1" style="width:395px;"><%=curRole.Description %></textarea></td></tr>
		<tr><td valign="top">功能</td><td><div id="treeContainer"><div id="tree"></div></div></td></tr>
	 </table>
	 </div>
	 <div class="editFormBottom"><input type="button" value="  保存  " onclick="doSave()" />&nbsp;<input type="button" value=" 取消 " onclick="self.close()" /> <input type="hidden" id="hidSelFuncId" name="hidSelFuncId" value="" /> <span id="tipSpan"><%=tip %></span></div>
    </form>
</body>
</html>
